package com.polly.esphwevent.common.exceptions;

import lombok.Data;

/**
 * @author liqin@nd.com.cn
 * @version V1.0
 * @title: ServiceException
 * @description: TODO(用一句话描述该文件做什么)
 * @date: 2019/2/21 21:28
 */
@Data
public class ServiceException extends RuntimeException {

    private Integer code;

    private String errorMessage;

    public ServiceException(Integer code, String errorMessage) {
        super(errorMessage);
        this.code = code;
        this.errorMessage = errorMessage;
    }

    public ServiceException(AuthExceptionEnum authExceptionEnum){
        super(authExceptionEnum.getMessage());
        this.code = authExceptionEnum.getCode();
        this.errorMessage = authExceptionEnum.getMessage();
    }

}
